package com.module.overview.ui.cardHistoryDetails

import com.chad.library.adapter.base.BaseProviderMultiAdapter
import com.chad.library.adapter.base.provider.BaseItemProvider
import com.common.app.data.bean.CalendarDay
import com.common.app.data.bean.overView.HistoryDetailsModel
import com.common.app.widget.provider.CommonEmptyProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityCalorieCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityRatioCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityRecordCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityStandingDurationCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityStateCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityStepsCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityStrengthCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivitySummaryCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvActivityTheDayCalorieCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvPressureDistributionCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvPressureRatioCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvPressureSleepCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvPressureStateValueCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvPressureSummaryCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSignsHrCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSignsHrvCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSignsOxyCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSignsResRateCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSignsStateCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSignsTempCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSleepNapRecordCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSleepPeriodCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSleepStateCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSleepSubScoringCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSleepSummaryCardProvider
import com.module.overview.ui.cardHistoryDetails.provider.OvSleepTotalDurationCardProvider

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：10/7/2025
 *
 * 描述：
 *
 * 修订历史：
 *
 */
class OverviewHistoryDetailsCardAdapter(mCalendar: CalendarDay?) : BaseProviderMultiAdapter<HistoryDetailsModel>() {

    init {
        addItemProvider(CommonEmptyProvider<HistoryDetailsModel>())

        //压力相关
        addItemProvider(OvPressureSleepCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvPressureRatioCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvPressureStateValueCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvPressureDistributionCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvPressureSummaryCardProvider(mCalendar))

        //体征相关
        addItemProvider(OvSignsStateCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvSignsHrCardProvider(mCalendar))
        addItemProvider(OvSignsOxyCardProvider(mCalendar))
        addItemProvider(OvSignsHrvCardProvider(mCalendar))
        addItemProvider(OvSignsTempCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvSignsResRateCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))

        //睡眠相关
        addItemProvider(OvSleepStateCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvSleepSubScoringCardProvider())
        addItemProvider(OvSleepTotalDurationCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvSleepPeriodCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvSleepNapRecordCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvSleepSummaryCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))


        //活动相关
        addItemProvider(OvActivityStateCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivityStepsCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivityCalorieCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivityTheDayCalorieCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivityStandingDurationCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivityStrengthCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivityRatioCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivityRecordCardProvider(mCalendar?.toCalendar()?.timeInMillis ?: 0L))
        addItemProvider(OvActivitySummaryCardProvider(mCalendar))
    }

    override fun getItemType(data: List<HistoryDetailsModel>, position: Int): Int {
        return data[position].itemType
    }

    fun getCusItemProvider(viewType: Int): BaseItemProvider<HistoryDetailsModel>? {
        return getItemProvider(viewType)
    }

}